//
//  UIScrollView+Refresh.m
//  YunDongGym
//
//  Created by lqq on 2018/7/25.
//  Copyright © 2018年 lqq. All rights reserved.
//

#import "UIScrollView+Refresh.h"
#import "RefreshHeader.h"
#import "RefreshFooter.h"
@implementation UIScrollView (Refresh)
/**
 *  添加下拉刷新
 *
 *  @param block 回调
 */
- (void)addHeaderWithRefreshingBlock:(void(^)())block
{
    RefreshHeader *header = [RefreshHeader headerWithRefreshingBlock:block];
    self.mj_header = header;
}
- (void)addHeaderWithRefreshingTarget:(id)target refreshingAction:(SEL)action
{
    RefreshHeader *header = [RefreshHeader headerWithRefreshingTarget:target refreshingAction:action];
    self.mj_header = header;
}
/**
 *  开始下拉刷新
 */
-(void)beginHeaderRefreshing
{
    [self.mj_header beginRefreshing];
}

/**
 *  结束下拉刷新
 */
- (void)endHeaderRefreshing
{
    [self.mj_header endRefreshing];
}


/**
 是否隐藏刷新头
 
 @param hidden
 */
- (void)hideHeader:(BOOL)hidden
{
    [self.mj_header setHidden:hidden];
}

/**
 *  添加上拉刷新
 *
 *  @param block 回调
 */
- (void)addFooterWithRefreshingBlock:(void(^)())block
{
    RefreshFooter *footer = [RefreshFooter footerWithRefreshingBlock:block];
    footer.automaticallyHidden = YES;
    self.mj_footer = footer;
}
- (void)addFooterWithRefreshingTarget:(id)target refreshingAction:(SEL)action
{
    RefreshFooter *footer = [RefreshFooter footerWithRefreshingTarget:target refreshingAction:action];
    footer.automaticallyHidden = YES;
    self.mj_footer = footer;
}

/**
 *  结束上拉刷新
 */
- (void)endFooterRefreshing
{
    [self.mj_footer endRefreshing];
}

/**
 *  没有更多数据
 */
- (void)endRefreshingWithNoMoreData
{
    [self.mj_footer endRefreshingWithNoMoreData];
}


/**
 是否隐藏刷新尾
 
 @param hidden
 */
- (void)hideFooter:(BOOL)hidden
{
    [self.mj_footer setHidden:hidden];
}
@end
